Open
Conversation
de88a89 to
4e74881
Compare
…ests OpenSSL 3.x rejects a NULL pointer passed to EVP_PKEY_CTX_set1_hkdf_salt() even with length 0. Use an empty string "" instead of nullptr when useSalt is false. This works on both OpenSSL 1.1.x and 3.x. Also added version-guard comments to all #if/#else/#endif blocks for clarity. Fixes rdkcentral#75
4e74881 to
610caf8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix 8 DH/ECDH key exchange test failures on OpenSSL 3.x when
useSalt=SEC_FALSE.Problem
The
hkdf()function inexchange.cpppassesnullptrtoEVP_PKEY_CTX_set1_hkdf_salt()when no salt is used. OpenSSL 3.x rejectsa NULL pointer even with length 0, causing all
testKeyExchangeDHandtestKeyExchangeECDHtests withSEC_FALSEto fail.Fix
Replace
nullptrwith""(empty string) for the no-salt case. This providesa valid non-NULL pointer with length 0, which both OpenSSL 1.1.x and 3.x accept.
The version-specific
#if/#elseguard for this call is no longer needed andhas been removed.
Also added descriptive comments to all remaining
#if/#else/#endifblocks.Testing
Verified 8/8 affected tests pass on:
Fixes #75
Test Results: DH/ECDH Key Exchange (Tests 1193–1207)
Affected Tests
testKeyExchangeDHAES_128SEC_FALSEtestKeyExchangeDHAES_256SEC_FALSEtestKeyExchangeDHHMAC_128SEC_FALSEtestKeyExchangeDHHMAC_256SEC_FALSEtestKeyExchangeECDHAES_128SEC_FALSEtestKeyExchangeECDHAES_256SEC_FALSEtestKeyExchangeECDHHMAC_128SEC_FALSEtestKeyExchangeECDHHMAC_256SEC_FALSEResults Matrix
Without fix (main branch)
With fix (PR #76)